// Create WebSocket connection.
var ws = new WebSocket('ws://localhost:1271');

// Connection opened
ws.addEventListener('open', function (event) {
    ws.send('Hello Server!');
});

// Listen for messages
ws.addEventListener('message', function (event) {
    const content = document.querySelector('#content');
    // console.log('Message from server ', event.data);
    content.innerHTML += event.data + '<br>';
});